<<<<<<< HEAD
package com.wzb.common.util;

import lombok.Data;

import java.util.Map;

import java.util.concurrent.ConcurrentHashMap;

=======
package com.nanhang.common.util;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

>>>>>>> 867f404b24accd472cc289df5d203de00408060a
@Data
public class R {
	private Integer code;
	private String message;
<<<<<<< HEAD
	private Map<String, Object> data;

	// 构造函数初始化
	private R() {
		this.data = new ConcurrentHashMap<>(); // 使用线程安全的ConcurrentHashMap
	}

	// 1. 成功时的方法
	public static R ok() {
=======
	private Map<String,Object> data = new HashMap<>();


	public static R ok(){
>>>>>>> 867f404b24accd472cc289df5d203de00408060a
		R r = new R();
		r.setCode(200);
		r.setMessage("操作成功！");
		return r;
	}

<<<<<<< HEAD
	// 2. 失败时的调用方法
	public static R error() {
=======
	public static R error(){
>>>>>>> 867f404b24accd472cc289df5d203de00408060a
		R r = new R();
		r.setCode(500);
		r.setMessage("操作失败！");
		return r;
	}

<<<<<<< HEAD
	// 3. 设置出错信息
	public R message(String message) {
=======

	public R message(String message){
>>>>>>> 867f404b24accd472cc289df5d203de00408060a
		this.setMessage(message);
		return this;
	}

<<<<<<< HEAD
	// 4. 修改错误码
	public R code(Integer code) {
=======
	public R code(Integer code){
>>>>>>> 867f404b24accd472cc289df5d203de00408060a
		this.setCode(code);
		return this;
	}

<<<<<<< HEAD
	// 5. 设置添加数据
	public R data(String key, Object value) {
		this.data.put(key, value);
		return this;
	}

	// 6. 设置添加多个数据
	public R data(Map<String, Object> map) {
		this.data.putAll(map);  // 使用putAll来合并多个数据
		return this;
	}
}

=======
	public R data(String key, Object value){
		this.data.put(key,value);
		return this;
	}
	public R data(Map<String,Object> map){
		this.setData(map);
		return this;
	}

}
>>>>>>> 867f404b24accd472cc289df5d203de00408060a
